package com.ficus.road.maintain.core.model.zh.xlj;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

/**
 * @author xiawen yang
 * @date 2022/6/27 上午11:42
 */
@Data
public class XljWarningZH {
    private String warningId;

    private String xljId;

    private String xljName;

    private Date createTime;
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private Date updateTime;
    // 最大水位时间
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private Date maxDepthTime;
    // 封交时间
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private Date closeTime;
    // 解封时间
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private Date uncloseTime;
    // 结束时间
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private Date endTime;
    // 是否结束 1结束 0未结束
    private Integer isEnd;
    // 是否封过交 1是 0否
    private Integer isClosed;
    // 是否排过水 1是 0否
    private Integer isDrain;
    // 封交状态 1是 0否
    private Integer closed;
    // 排水状态 1是 0否
    private Integer drain;
    // 最大水位
    private Integer maxDepth;

    public XljWarning convert2XljWarning(XljWarningZH zh, Date date) {
        return XljWarning.builder()
                .id(zh.getWarningId())
                .xljId(zh.getXljId())
                .xljName(zh.getXljName())
                .createTime(zh.getCreateTime())
                .updateTime(zh.getUpdateTime())
                .maxDepthTime(zh.getMaxDepthTime())
                .closeTime(zh.getCloseTime())
                .uncloseTime(zh.getUncloseTime())
                .endTime(zh.getEndTime())
                .isEnd(zh.getIsEnd())
                .isClosed(zh.getIsClosed())
                .isDrain(zh.getIsDrain())
                .closed(zh.getClosed())
                .drain(zh.getDrain())
                .maxDepth(zh.getMaxDepth())
                .syncTime(date)
                .build();
    }
}
